﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PPSignSDKDemoForm
{
    public partial class L1000SignWndForm : Form
    {
        TextBox g_tbStatus = null;
        MainWnd mainWnd;

        public L1000SignWndForm(MainWnd mwForm)
        {
            mainWnd = mwForm;

            this.FormBorderStyle = FormBorderStyle.None;
            InitializeComponent();

            // create cancel button
            Button cancelBtn = new Button();
            cancelBtn.Left = 440;
            cancelBtn.Top = 730;
            cancelBtn.Width = 100;
            cancelBtn.Height = 50;
            cancelBtn.Text = "Cancel";
            cancelBtn.Click += CancelBtn_Click;
            this.Controls.Add(cancelBtn);

            // create ok button
            Button okBtn = new Button();
            okBtn.Left = 740;
            okBtn.Top = 730;
            okBtn.Width = 100;
            okBtn.Height = 50;
            okBtn.Text = "OK";
            okBtn.Click += OkBtn_Click;
            this.Controls.Add(okBtn);

            // create textbox (tbStatus)
            g_tbStatus = new TextBox();
            g_tbStatus.Name = "L1000_tbStatus";
            g_tbStatus.ReadOnly = true;
            g_tbStatus.Left = 50;
            g_tbStatus.Top = 660;
            g_tbStatus.Width = 1180;
            g_tbStatus.Height = 50;
            g_tbStatus.Text = "You may start signing now.";
            this.Controls.Add(g_tbStatus);
        }

        private void OkBtn_Click(object sender, EventArgs e)
        {
            Button btnMainWndSaveImage = (Button)mainWnd.Controls.Find("SaveImageL398Btn", true)[0];
            btnMainWndSaveImage.PerformClick();

            TextBox tbStatus = (TextBox)mainWnd.Controls.Find("textL398Status", true)[0];
            g_tbStatus.Text = tbStatus.Text;
        }

        private void CancelBtn_Click(object sender, EventArgs e)
        {
            Button btnMainWndClear = (Button)mainWnd.Controls.Find("ClearL398Btn", true)[0];
            btnMainWndClear.PerformClick();
            g_tbStatus.Text = "You may start signing now.";
        }
    }
}
